<template>
  <div class="login-modal">
    <div class="mask" @click="chanIsShowLoginModal(false)"></div>
    <div class="login-box">
      <img
        src="@/assets/img/close.png"
        class="guanbi"
        @click="chanIsShowLoginModal(false)"
      />
      <ul class="title">
        <li
          :class="isWeixin == false ? 'active' : ''"
          @click="isWeixin = false"
        >
          手机号码登陆
        </li>
        <li style="cursor: auto; font-size: 25px">&nbsp;&nbsp;|&nbsp;&nbsp;</li>
        <li :class="isWeixin == true ? 'active' : ''" @click="isWeixin = true">
          薇信扫描登陆
        </li>
      </ul>
      <div class="hezi">
        <div class="form" v-show="!isWeixin">
          <div class="shoujihao">
            <input type="text" class="phonenum" placeholder="请输入手机号" />
          </div>
          <div class="inputgroup">
            <slide-verify
              :l="42"
              :r="20"
              :w="310"
              :h="140"
              slider-text="向右滑动"
              @success="onSuccess"
              @fail="onFail"
              @refresh="onRefresh"
              :style="{ width: '100%' }"
              class="slide-box"
              ref="slideBlock"
              :slide-text="msg"
            ></slide-verify>
          </div>
          <div class="inputgr">
            <input type="text" class="kuang" placeholder="请输入短信验证码" />
            <div class="yanzhengma">获取验证码</div>
          </div>
          <div class="btn">点击登录</div>
        </div>
        <div class="erweicode" v-show="isWeixin">薇信二维码</div>
      </div>
    </div>
  </div>
</template>
  
  <script>
import { mapMutations } from "vuex";
export default {
  name: "Login",
  data() {
    return {
      // 切换
      isWeixin: false,
      // 验证码
      msg: "向右滑动",
    };
  },

  methods: {
    ...mapMutations({
      // 拿到模块文件夹showLoginModal，的方法名changIsShowLoginModal
      chanIsShowLoginModal: "showLoginModal/chanIsShowLoginModal",
    }),
    onSuccess() {
      this.msg = "login success";
    },
    onFail() {
      this.msg = "";
    },
    onRefresh() {
      this.msg = "";
    },
  },
  mounted() {},
};
</script>
  
  <style lang="less" scoped>
@import "../assets/global.less";
.login-box {
  width: 555px;
  height: 423px;
  background: url(../assets/img/login-box-bg.png);
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  .guanbi {
    position: absolute;
    right: 60px;
    top: 20px;
  }
  .title {
    display: flex;
    justify-content: center;
    font-size: 18px;
    li {
      line-height: 80px;
      color: #aaa;
      cursor: pointer;
    }
    .active {
      color: #933333;
    }
  }
  .hezi {
    width: 375px;
    margin: 0 auto;
    .shoujihao {
      width: 375px;
      height: 50px;
      display: flex;
      justify-content: space-between;
      position: absolute;
      top: 92px;
      .phonenum {
        border: 1px solid #aaa;
        width: 100%;
        padding: 9px;
      }
    }
    .inputgroup{
    position: absolute;
    top: 15px;
    width: 309px;
    }
    .inputgr {
      width: 375px;
      height: 50px;
      display: flex;
      justify-content: space-between;
      position: absolute;
      top: 222px;
      .kuang {
        width: 245px;
        padding: 9px;
        border: 1px solid #aaa;
      }
      .yanzhengma {
        width: 90px;
        background-color: @base-color;
        color: #fff;
        line-height: 50px;
        text-align: center;
      }
    }
    .btn {
      height: 50px;
      width: 373px;
      background-color: @base-color;
      position: absolute;
      top: 299px;
      left: 90px;
      color: #fff;
      text-align: center;
      line-height: 50px;
      cursor: pointer;
      font-size: 18px;
    }
  }
}
.login-modal {
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.5);
}
.mask {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}
</style>